<template>
	<view>
	    <cu-custom bgColor="bg-gradual-fff" isBack="true">
	    	<block slot="content">{{info.title}}</block> 
	    </cu-custom>
	    <u-loading-page :loading="true" loading-text="loading..." v-if="showLoading"></u-loading-page>
	    <view v-show="!showLoading">
			<view class="video_a" v-if="info.video_url">
				<video
					id="myVideo"
					:controls="true"
					:http-cache="true"
					:page-gesture="false"
					:show-loading="false"
					:show-center-play-btn="false"
					:enable-progress-gesture="true"
					object-fit="cover"
					:src="info.video_url"
					>
				</video>
			</view>
			<view class="article_b_a_ca">
				<view class="article_b_a_c">
					<view class="article_b_a_c_a">
						<image :src="info.company_logo"></image>
					</view>
					<view class="article_b_a_c_b">{{info.company_name}}</view>
					<view class="article_b_a_c_b">{{info.create_time}}</view>
				</view>
				<view class="article_b_a_d">
					<view class="article_b_a_d_a">
						<view class="article_b_a_d_a_a">
							<u-icon name="eye" color="#3D3D3D" size="15"></u-icon>
						</view>
						<view class="article_b_a_d_a_b">{{info.visit}}</view>
					</view>
					<view class="article_b_a_d_a" @click="user_collect_post()">
						<view class="article_b_a_d_a_a">
							<u-icon name="heart" :color="info.is_collect>0?'#E71102':'#3D3D3D'" size="15"></u-icon>
						</view>
						<view class="article_b_a_d_a_b">{{info.likes}}</view>
					</view>
					<button open-type="share" class="article_b_a_d_a" style="float: right;margin: 0;">
						<view class="article_b_a_d_a_a">
							<u-icon name="share" color="#3D3D3D" size="15"></u-icon>
						</view>
						<view class="article_b_a_d_a_b">分享</view>
					</button>
				</view>
			</view>
			<view class="content_a">
				<u-parse :content="info.content"></u-parse>
			</view>
		</view>
	</view>
</template>

<script>
import request from '@/common/request.js';
export default {
  data() {
    return {
	  showLoading:true,
      info:[],
	  id:'',
	  type:'',
	  uid:0,
    };
  },
  onLoad: function (options) {
	this.id=options.id??1;
	this.uid=uni.getStorageSync('uid');
	this.distribution_code=uni.getStorageSync('code');
	this.user_post();
  },
  onShareAppMessage(res) { //发送给朋友
  	return {
  		title:this.info.title,
  		path:'/pages/home/vendor?distribution_code='+this.distribution_code,
  		imageUrl:this.info.image,
  		desc:this.info.synopsis,
  		content:this.info.synopsis
  	}
  },
  onShareTimeline(res) {//分享到朋友圈
  	return {
  		title:this.info.title,
  		path:'/pages/home/vendor?distribution_code='+this.distribution_code,
  		imageUrl:this.info.image,
  		desc:this.info.synopsis,
  		content:this.info.synopsis
  	}
  },
  methods: {
	  user_collect_post() {
	  	let paramsList = {
	  		unionid: this.id,
	  		uid:this.uid
	  	}
	  	let optsList = {
	  		url: 'u-user_collect',
	  		method: 'post'
	  	};
	  	let _this = this;
	  	request.httpRequest(optsList, paramsList).then(res => {
	  		if (res.data.code == 200) {
				_this.user_post();
	  		}
	  	});
	  },
	  user_post(){
	  	let paramsList = {
			id:this.id,
			uid:this.uid
	  	}
	  	let optsList = {
	  		url: 'a-detail',
	  		method: 'post'
	  	};
	  	let _this=this;
	  	request.httpRequest(optsList, paramsList).then(res => {
	  		if(res.data.code == 200){
	  			_this.info=res.data.data;
				uni.setNavigationBarTitle({
					title: _this.info.title
				});
	  		}
	  		this.showLoading=false;
	  	});
	  },
  }
};
</script>
<style>
button::after{
	border: 0;
}
button{
	background-color:#FFFFFF;
	padding-left: 0;
	padding-right: 0;
}
.video_a{
	width: 750rpx;
	height: 400rpx;
	z-index: 999;
}
.video_a video{
	width: 750rpx;
	height: 400rpx;
}
.article_b_a_c{
	margin-top: 20rpx;
	overflow: hidden;
}
.article_b_a_c_a{
	width: 40rpx;
	height: 40rpx;
	border-radius: 50%;
	float: left;
}
.article_b_a_c_a image{
	width: 100%;
	height: 100%;
	border-radius: 50%;
}
.article_b_a_c_b{
	float: left;
	margin-left: 15rpx;
	font-family: 思源黑体;
	font-size: 24rpx;
	font-weight: normal;
	line-height: 40rpx;
	color: #666666;
}
.article_b_a_d{
	overflow: hidden;
	margin-top: 20rpx;
}
.article_b_a_d_a{
	float: left;
	margin-right: 40rpx;
}
.article_b_a_d_a_a{
	float: left;
}
.article_b_a_d_a_b{
	font-family: Source Han Sans;
	font-size: 24rpx;
	font-weight: normal;
	line-height:33rpx;
	color: #666666;
	float: left;
	margin-left: 15rpx;
}
.article_b_a_d_b{
	float: right;
	font-family: Source Han Sans;
	font-size: 24rpx;
	font-weight: normal;
	line-height:33rpx;
	color: #666666;
}
.article_b_a_ca{
	width: 700rpx;
	margin: auto;
	margin-top: 20rpx;
}
.content_a{
	width: 700rpx;
	margin: auto;
	margin-top: 20rpx;
}
</style>